// pages/collect/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tabs:[
      {
        id:0,
        value:"综合",
        isActive:true
      },
      {
        id:2,
        value:"销量",
        isActive:false
      },
      {
        id:3,
        value:"价格",
        isActive:false
      },
    ],
    collection:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
  onShow: function () {
    this.collection()
  },
  tabsItemChange(e){
    const {index} = e.detail
    let {tabs} = this.data
    tabs.forEach((v,i)=>i===index?v.isActive=true:v.isActive=false)
    this.setData({
      tabs
    })
  },
  collection(){
    const collection = wx.getStorageSync('collection');
    console.log(collection)
    this.setData({collection})
  }
})